import time
import unittest

from selenium.webdriver.common.by import By
from selenium import webdriver
from business.login import Login
from pom.base import BaseDriver


class Test_Login(unittest.TestCase):
    def setUp(self) -> None:
        self.driver = webdriver.Chrome()
        BaseDriver(self.driver).get_url()
        self.l = Login(self.driver)



    def tearDown(self) -> None:
        time.sleep(5)
        BaseDriver(self.driver).quit_webdriver()


    def test_account_login(self):
        self.l.account_login("jiayingjie@forensix.cn", "Jyj1234!")
        self.assertEqual(self.l.logined_name(),"贾颖婕")

    def test_login_fail(self):
        text = self.l.account_login_fail("jiayingjie@forensix.cn", "123456")
        self.assertEqual(text, "用户名或密码错误")


    def test_system_login(self):
        self.l.system_login("user@123.com", "1")
        self.assertEqual(self.l.logined_name(),"系统用户")



if __name__ == "__main__":
    unittest.main()

